package com.guigu.xiaowenbo.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.guigu.util.PageVo;
import com.guigu.xiaowenbo.mapper.SpayMapper;
import com.guigu.xiaowenbo.pojo.Spay;
import com.guigu.xiaowenbo.service.SpayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SpayServiceImpl implements SpayService {
    @Autowired(required = false)
    SpayMapper spayMapper;
    public int insertre(Spay spay){
        spayMapper.insertre(spay);
        return spay.getId();
    }
    public PageVo selectrw(Integer num,Integer size){
        PageHelper.startPage(num,size);
        List<Spay> list = spayMapper.selectrw();
        PageInfo pageInfo = new PageInfo(list);
        PageVo pageVo = new PageVo();
        pageVo.setTotal(pageInfo.getTotal());
        pageVo.setRows(pageInfo.getList());
        return pageVo;
    }
    public int updaterw(Spay spay){
        return spayMapper.updaterw(spay);
    }
    public PageVo selectrwe(Integer num,Integer size){
        PageHelper.startPage(num,size);
        List<Spay> list = spayMapper.selectrwe();
        PageInfo pageInfo = new PageInfo(list);
        PageVo pageVo = new PageVo();
        pageVo.setTotal(pageInfo.getTotal());
        pageVo.setRows(pageInfo.getList());
        return pageVo;
    }
    public PageVo selectrwdd(Integer num,Integer size){
        PageHelper.startPage(num,size);
        List<Spay> list = spayMapper.selectrwdd();
        PageInfo pageInfo = new PageInfo(list);
        PageVo pageVo = new PageVo();
        pageVo.setTotal(pageInfo.getTotal());
        pageVo.setRows(pageInfo.getList());
        return pageVo;
    }
    public int updaterwd(String attemper,Integer gatherid){
        return spayMapper.updaterwd(attemper,gatherid);
    }
    public PageVo selectrwrs(Integer num,Integer size){
        PageHelper.startPage(num,size);
        List<Spay> list = spayMapper.selectrwrs();
        PageInfo pageInfo = new PageInfo(list);
        PageVo pageVo = new PageVo();
        pageVo.setTotal(pageInfo.getTotal());
        pageVo.setRows(pageInfo.getList());
        return pageVo;
    }

    public int updaterwre(String payid,String register){
        return spayMapper.updaterwre(payid,register);
    }
    public PageVo selectrwrssh(Integer num,Integer size){
        PageHelper.startPage(num,size);
        List<Spay> list = spayMapper.selectrwrssh();
        PageInfo pageInfo = new PageInfo(list);
        PageVo pageVo = new PageVo();
        pageVo.setTotal(pageInfo.getTotal());
        pageVo.setRows(pageInfo.getList());
        return pageVo;
    }
    public int updaterwreshs(Spay spay){
        return spayMapper.updaterwreshs(spay);
    }
    public int updaterwresh(Spay spay){
        return spayMapper.updaterwresh(spay);
    }
    public PageVo selectrwres(Integer num, Integer size){
        PageHelper.startPage(num,size);
        List<Spay> list = spayMapper.selectrwres();
        PageInfo pageInfo = new PageInfo(list);
        PageVo pageVo = new PageVo();
        pageVo.setTotal(pageInfo.getTotal());
        pageVo.setRows(pageInfo.getList());
        return pageVo;
    }

    @Override
    public int insert_WZY(Spay spay) {
        spayMapper.insert_WZY(spay);
        return spay.getId();
    }
}
